<!DOCTYPE html>
<html lang="zh_cn" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>家具进销存管理系统</title>
    <link rel="stylesheet" th:href="@{/static/layui/css/layui.css}" media="all">
    <link rel="stylesheet" th:href="@{/static/admin/style.css}" media="all">
</head>



</head>
<body class="layui-layout-body layadmin-global-background">
<div class="layui-container">
    <div class="layui-row">
        <div class="layui-col-md12 my-div">
        </div>
    </div>
</div>
<script src="layui/layui.js"></script>
</body>

<body>
    <h1>家具进销存系统</h1>
    <div class="login-main">
        <form class="layui-form UserLogin">
<!--            <header>登录</header>-->
            <h2>系统登录</h2>
            <div class="layui-input-inline">
                <input type="text" name="username" required lay-verify="required" placeholder="用户名" class="layui-input">
            </div>
            <div class="layui-input-inline">
                <input type="password" name="password" required lay-verity="required" placeholder="密码" class="layui-input">
            </div>
            <div class="layui-input-inline login-btn">
                <button lay-submit lay-filter="login">登录</button>
            </div>
        </form>
    </div>
    <script th:src="@{/static/layui/layui.js}"></script>
    <script>
        layui.use("form",function () {
            var form = layui.form;
            var $ = layui.$;
            //监听提交
            form.on("submit(login)",function (data) {
                $.ajax({
                    url:"/toLogin",
                    type:"POST",
                    data:data.field,
                    dataType:"json",
                    success: function (result) {
                        if(result.code == "1"){
                            layer.msg(result.msg,{icon:result.icon,anim:result.anim},function () {
                                location.href = "/index";    //登录成功，转向后台主页
                            });
                        }else{
                            layer.msg(result.msg,{icon:result.icon,anim:result.anim});
                        }
                    }
                });
                return false;
            });
        });
    </script>
</body>
</html>

</body>
<!--插入背景图片-->
<style>
    .layadmin-global-background {
        background-image: url("/static/images/login1.png");
        background-size: cover;
        background-position: center center;
        background-repeat: no-repeat;
        height: 800px;
    }
    h1{
        font: 56px "方正舒体"; /*设置字体和字体大小*/
        margin-left: 40px;
        margin-top: 40px;
        /*margin:50px auto; !*设置元素外边距*!*/
        font-weight: 500; /*设置字体粗细*/
        color: #1f1d1c; /*设置文字颜色*/
        -webkit-animation:bounce 2s infinite;/*设置动画*/
    }
    @-webkit-keyframes bounce{/*创建动画*/
        0%,100%,20%,50%,80%{
            -webkit-transform:translateY(0);
        }40%{
             -webkit-transform:translateY(-30px);
         }60%{
              -webkit-transform:translateY(-15px);
          }
    }
    .UserLogin{
        border-radius: 15px;
        background-clip: padding-box;
        margin: 90px auto;
        width: 350px;
        padding: 35px 35px 15px 35px;
        background: rgba(255, 255, 255, 0.5);
        border: 1px solid #eaeaea;
        box-shadow: 0 0 25px #cac6c6;
    }
    h2{
        text-align: center;
        margin-bottom: 50px;
    }
    input{
        border: 1px solid #eaeaea;
        padding: 13px 12px 13px 30px;
        margin: 0 auto 10px auto;
    }
    button{
        width: 100px;
        height: 40px;
        background-color: #01AAED;
        margin-bottom: 20px;
    }
</style>
</html>